import request from '@/utils/request'

export function fetchList(params) {
  return request({
    url: '/apply',
    method: 'get',
    params
  })
}

export function fetchDetail(id) {
  return request({
    url: `/apply/${id}`,
    method: 'get'
  })
}

export function create(data) {
  return request({
    url: '/apply',
    method: 'post',
    data
  })
}

// 修改审批状态
export function changeStatus(data) {
  return request({
    url: '/apply/changeStatus',
    method: 'post',
    data
  })
}

// 修改申请物品类型
export function changeTypes(data) {
  return request({
    url: '/apply/changeTypes',
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: '/apply',
    method: 'patch',
    data
  })
}

export function remove(id) {
  return request({
    url: `/apply/${id}`,
    method: 'delete'
  })
}
